// mouse.js
import { ref, onMounted, onUnmounted } from 'vue';
import { useStore } from 'vuex';

// 按照惯例，组合式函数名以“use”开头
export function useMouse() {
  // 被组合式函数封装和管理的状态
  const store = useStore();

  store.dispatch('home/updateHomeNavList');
  const categoryHeadList = computed(() => store.state.home.homeNavList);

  store.dispatch('home/updateShoppingCartList');
  const shoppingCarts = computed(() => store.state.home.shoppingCartList);

  // 通过返回值暴露所管理的状态
  return { store };
}
